<%@ page import="com.apexedu.portal.constant.Constants" %>
<%@ page import="com.apexedu.portal.entity.TFrontdeskNews" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
    request.setAttribute("basePath", basePath);
    TFrontdeskNews tfrontdesknews = (TFrontdeskNews) request.getAttribute("tfrontdesknews");
    String totalPages = (String) request.getAttribute("totalPages");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title><%=Constants.ProjectInfo.PROJECT_NAME%>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="${basePath}/resources/css/mh.shd.css" rel="stylesheet">
    <script type="text/javascript" src="${basePath}/resources/ui/js/jquery-1.8.3.js"></script>
    <style type="text/css">
        .section {
            background-color: #ffffff;
            border: 1px solid #eeeeee;
            height: 348px;
            padding: 0px 20px;
        }

        .section .title {
            float: left;
            border-bottom: 2px solid #f7f7f7;
            width: 100%;
        }

        .section .title {
            height: 60px;
        }

        .section .h3, .h5 {
            float: left;
            height: 60px;
            line-height: 60px;
        }

        .section .h3 {
            width: 130px;
            color: #2f2f2f;
            font-size: 18px;
            text-align: center;
            cursor: pointer;
        }

        .section .h3[class$="on"] {
            background-color: #f1f3f8;
        }

        .section .h5 {
            width: 40px;
            color: #adadad;
            font-size: 12px;
        }

        .section .ul {
            height: 210px;
            float: left;
            width: 100%;
        }

        .section .li {
            background-color: #fafafa;
            margin-top: 7px;
        }

        .section .li, .foot {
            float: left;
            height: 30px;
            width: 97%;
        }

        .section .li span {
            max-width: 85%;
            float: left;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            color: #adadad;
            margin-left: 5px;
        }

        .section .li .time {
            float: right;
            width: 50px;
            color: #adadad;
        }

        .section .li .time[class$="on"] {
            width: 85px;
        }

        .section .li span, .foot span, .li .time {
            height: 30px;
            line-height: 30px;
            font-size: 14px;
            display: block;
        }

        .section .li span, .foot span {
            text-align: left;
            cursor: pointer;
        }

        .section .foot {
            margin-top: 16px;
        }

        .section .foot span {
            width: 130px;
            color: #629fe6;
            float: right;
            margin-right: 10px;
        }
    </style>
    <script type="text/javascript">
        var temp = $(".ul").height();
        var totalPages =<%=totalPages%>;
        var pages = 1;
        //        $(window).resize(function(){
        //            searchlist();
        //            newslist();
        //        });
        $(function () {
            searchlist();
            newslist();
        });
        function searchlist() {
            $("#searchlist").click(function () {
                newslist();
            })
        }

        function newslist() {
            if (totalPages > pages) {
                var wz = '<%=tfrontdesknews.getWeiz()%>';
                $.post("${basePath}/s/shd/fdnv/unreadlist/" + wz + "-" + pages, function (result) {
                    if (result != 'unlogoin') {
                        $(".ul").append(result);
                        temp = temp + 225;
                        $(".ul").scrollTop(temp);
                    }
                });
                pages = pages + 1;
            } else if (totalPages == pages) {
                var wz = '<%=tfrontdesknews.getWeiz()%>';
                $.post("${basePath}/s/shd/fdnv/unreadlist/" + wz + "-" + pages, function (result) {
                    if (result != 'unlogoin') {
                        $(".ul").append(result);
                        temp = temp + 225;
                        $(".ul").scrollTop(temp);
                    }
                });
                pages = pages + 1;
                $(".foot").hide();
            } else {
                $(".foot").hide();
            }
        }
        function gotoHtml(url) {
            window.open('${basePath}/s/uc/shd/fdnv/' + url);
        }
    </script>
</head>
<body>
<div class="section">
    <div class="title">
        <div class="h3 ">通知公告</div>
    </div>
    <div class="ul" style="overflow-y:auto;height: 223px;">

    </div>
    <div class="foot">
        <span id="searchlist">查看更多通知<a href="javascript:;"><img alt=""
                                                                src="${basePath}/resources/images/shd/icon_all.png"
                                                                width="14" height="14"
                                                                style="padding-left: 3px; vertical-align:middle;border: 0;"/></a></span>
    </div>
</div>
</body>
</html>